package host

import (
	"time"

	"github.com/gin-gonic/gin"
	"inspur.com/cloudware/model"
)

func AddHost(req *model.HostReq, c *gin.Context) (string, error) {
	host := new(model.Host)
	host.HostId = req.HostId
	host.Sn = req.Sn
	host.HostName = req.HostName
	host.Region = req.Region
	host.DataCenter = req.DataCenter
	host.RackPosition = req.RackPosition
	host.BmcIp = req.BmcIp
	host.AdminIp = req.AdminIp
	host.BussiIp = req.BussiIp
	host.StorIp = req.StorIp

	host.PxeMac = req.PxeMac
	host.CpuCores = req.CpuCores
	host.Memory = req.Memory
	host.DiskCount = req.DiskCount
	host.NicCount = req.NicCount
	host.DiscoveryTime = time.Now()

	err := host.AddHost()
	return host.HostId, err
}

func RemoveHostById(hostId int64) int64 {
	return 0
}
